package echo;

/**
 * Write a description of class ParteImaginaria here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ParteImaginariaLeaf implements INumeroComplexoComponent
{
    Integer b;
    
    /**
     * Constructor for objects of class ParteReal
     */
    public ParteImaginariaLeaf()
    {
        b = new Integer(0);
    }
    
    public void zerar()
    {  
        b = new Integer(0);
    }
    
    public void entrarParteReal(Integer base, Integer n){}    
    public void somarParteReal(Integer base, INumeroComplexoComponent numComposite){}
   
    public void entrarParteImaginaria(Integer base, Integer n) 
    {
        b = b * base + n;
    }    

    public void somarParteImaginaria(Integer base, INumeroComplexoComponent numComposite)
    {
        b = b + numComposite.getParteImaginaria();
    }
    
    public Integer getParteReal(){return new Integer(0);} //!!!como remover isso  
    
    public Integer getParteImaginaria()  
    {
        return new Integer(b.intValue());
    } //!!!como remover isso
    
    public String toString()
    {
        if (b != 0)
            return "I" + b.toString();
        else
            return "";
    }
    
    public String toBinaryString()
    {
        if (b != 0)        
            return "I0b" + Integer.toBinaryString(b);
        else
            return "";
    }

    public String toHexString()
    {
        if (b != 0)
            return "I0x" + Integer.toHexString(b);
        else
            return "";            
    }    
}
